home *** CD-ROM | disk | FTP | other *** search
/ PC World Interactive 7 / PC World Interactive 7.iso / program / ctutor.exe / SOURCE / CHAROUT.C < prev    next >
C/C++ Source or Header  |  1994-05-15  |  823b  |  38 lines

  1.                              /* Chapter 10 - Program 2 - CHAROUT.C */
  2. #include "stdio.h"
  3. #include "string.h"
  4.  
  5. void main()
  6. {
  7. FILE *point;
  8. char others[35];
  9. int  indexer, count;
  10.  
  11.    strcpy(others, "Additional lines.");
  12.    point = fopen("tenlines.txt", "a");     /* open for appending   */
  13.  
  14.    for (count = 1 ; count <= 10 ; count++) {
  15.       for (indexer = 0 ; others[indexer] ; indexer++)
  16.          putc(others[indexer], point);     /* output one character */
  17.       putc('\n', point);                   /* output a linefeed    */
  18.    }
  19.    fclose(point);
  20. }
  21.  
  22.  
  23.  
  24. /* Result of output (appended to TENLINES.TXT)
  25.  
  26. Additional lines.
  27. Additional lines.
  28. Additional lines.
  29. Additional lines.
  30. Additional lines.
  31. Additional lines.
  32. Additional lines.
  33. Additional lines.
  34. Additional lines.
  35. Additional lines.
  36.  
  37. */
  38.